import defineReactiveData from './defineReactiveData'
import observeArr from './observeArr'
import {arrMethods} from './array'
function Observer(data) {
    if (Array.isArray(data)) {
        data.__proto__=arrMethods
        observeArr(data)
    } else {
        this.walk(data)
    }
}

Observer.prototype.walk = function (data) {
    // var keys = Object.keys(data)
    // for (let i = 0; i < keys.length; i++) {
    //     let key = keys[i]
    //     let value = data[key]
    // }
    for (const key in data) {
        defineReactiveData(data,key,data[key])
    }
}

export default Observer